/***************************************************************************//**
 * @file GUI/ComboUnits.h
 * @author  Marek M. Cel <marekcel@mscsim.org>
 *
 * @section LICENSE
 *
 * Copyright (C) 2013 Marek M. Cel
 *
 * This file is part of MScSim. You can redistribute and modify it under
 * the terms of GNU General Public License as published by the Free Software
 * Foundation; either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Further information about the GNU General Public License can also be found
 * on the world wide web at http://www.gnu.org.
 ******************************************************************************/
#ifndef COMBO_UNITS_H
#define COMBO_UNITS_H

////////////////////////////////////////////////////////////////////////////////

#include <QComboBox>

////////////////////////////////////////////////////////////////////////////////

#define NUM_UNITS_COUNT 1
#define LEN_UNITS_COUNT 4
#define VEL_UNITS_COUNT 5
#define ANG_UNITS_COUNT 2
#define ROT_UNITS_COUNT 2

////////////////////////////////////////////////////////////////////////////////

/** */
class ComboUnits : public QComboBox
{
    Q_OBJECT

public:

    /** */
    enum UnitsType
    {
        Number = 0,     ///< number
        Length,         ///< length
        Velocity,       ///< velocity
        Angle,          ///< angle
        RotationRate    ///< rotation rate
    };

    /** Constructor. */
    explicit ComboUnits( UnitsType unitsType = Number, QWidget *parent = 0 );
    
    /** Destructor. */
    virtual ~ComboUnits();
    
    /** */
    float convertFactor() { return m_convertFactor; }
    
protected:

    float   m_numCoefs[ NUM_UNITS_COUNT ];  ///< [-] convertion factors
    QString m_numNames[ NUM_UNITS_COUNT ];  ///< units names

    float   m_lenCoefs[ LEN_UNITS_COUNT ];  ///< [-] convertion factors
    QString m_lenNames[ LEN_UNITS_COUNT ];  ///< units names

    float   m_velCoefs[ VEL_UNITS_COUNT ];  ///< [-] convertion factors
    QString m_velNames[ VEL_UNITS_COUNT ];  ///< units names

    float   m_angCoefs[ ANG_UNITS_COUNT ];  ///< [-] convertion factors
    QString m_angNames[ ANG_UNITS_COUNT ];  ///< units names

    float   m_rotCoefs[ ROT_UNITS_COUNT ];  ///< [-] convertion factors
    QString m_rotNames[ ROT_UNITS_COUNT ];  ///< units names

    float   m_convertFactor;    ///< [-]

    UnitsType m_unitsType;      ///< according to UnitsType enum

    /** */
    void initialize();
    
protected slots:

    /** */
    void on_currentIndexChanged( int index );
};

////////////////////////////////////////////////////////////////////////////////

#endif // COMBO_UNITS_H
